// 搜索历史仓库
import { setSession,getSession } from "@/utils"


export default ({
    namespaced:true,
    state: {
        keyword:getSession('keyword')||'',
        historyList: getSession('historyList')||[],           
    },
    mutations: {
        search(state,playload){
            state.keyword=playload
            setSession('keyword',state.keyword)
            if (state.historyList.indexOf(state.keyword)==-1) {
                state.historyList.push(state.keyword)
            }
            setSession('historyList',state.historyList)
        }
    },
})